package com.ruoyi.system.mapper;


import com.ruoyi.system.domain.Camera_Model;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface Camera_ModelMapper {

    @Select("select * from camera_model")
    List<Camera_Model> findAll();

    @Update("update camera_model set state = #{key} where id = #{id};")
    void changeState(String id, int key);

    @Insert("INSERT INTO camera_model(id, camera_id, model_id, state, start_time, end_time, time_span, pattern, voice, playback_times, monday, tuesday, wednesday, thursday, friday, saturday, sunday)" +
            " VALUES (#{id}, #{camera_id}, #{model_id}, #{state}, #{start_time}, #{end_time}, #{time_span}, #{pattern}, #{voice}, #{playback_times}, #{monday}, #{tuesday}, #{wednesday}, #{thursday}, #{friday}, #{saturday}, #{sunday});")
    void add(Camera_Model camera_model);

    @Select("select * from camera_model where id = #{id};")
    Camera_Model findById(String id);

    @Update("update camera_model set start_time = #{start_time}, end_time = #{end_time}, time_span = #{time_span}, pattern = #{pattern}, voice = #{voice}," +
            "playback_times = #{playback_times}, monday = #{monday}, tuesday = #{tuesday}, wednesday = #{wednesday}, thursday = #{thursday}, friday = #{friday}, saturday = #{saturday}," +
            "sunday = #{sunday} where id = #{id};")
    boolean upadte(Camera_Model camera_model);
}
